﻿<Window x:Class="ExpressionEvolver.Client.Windows.MainWindow"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
	xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
	Title="ExpressionEvolver" Height="600" Width="800"
	WindowStartupLocation="CenterScreen" FontSize="16">
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>
		<StackPanel Grid.Row="0" Grid.Column="0" Margin="5">
			<Label Content="Expression:" />
			<TextBox Text="{Binding Path=Expression, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
			<TextBox Text="Example - a => ((Math.Pow(a, 0.5) * a * a) + a)" IsReadOnly="True" />
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition Height="*" />
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="*" />
				</Grid.ColumnDefinitions>
				<Button Grid.Row="0" Grid.Column="0" Margin="0,5,0,0"
					Content="Evolve" Click="OnEvolveClick" IsEnabled="{Binding Path=IsEvolveEnabled}" />
			</Grid>
		</StackPanel>
		<charting:Chart Grid.Row="1" Grid.Column="0" Margin="5" BorderThickness="0">
			<charting:LineSeries
				ItemsSource="{Binding Path=BaseLine}"
				DependentValuePath="Y"
				IndependentValuePath="X" 
				Title="Base line" />
			<charting:LineSeries
				ItemsSource="{Binding Path=EvolvingLine}"
				DependentValuePath="Y"
				IndependentValuePath="X" 
				Title="Evolving line" />
		</charting:Chart>
		<Grid Grid.Row="2" Grid.Column="0">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="*" />
			</Grid.ColumnDefinitions>
			<Label Grid.Row="0" Grid.Column="0" Content="Generation:" HorizontalAlignment="Right" />
			<Label Grid.Row="0" Grid.Column="1" Content="{Binding Path=Generation}" />
			<Label Grid.Row="1" Grid.Column="0" Content="Best Expression:" HorizontalAlignment="Right" />
			<!--<Label Grid.Row="1" Grid.Column="1" Content="{Binding Path=BestExpression}" />-->
			<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=BestExpression, Mode=OneWay}" IsReadOnly="True" />
			<Label Grid.Row="2" Grid.Column="0" Content="Best Fitness:" HorizontalAlignment="Right" />
			<Label Grid.Row="2" Grid.Column="1" Content="{Binding Path=BestFitness}" />
			<Label Grid.Row="3" Grid.Column="0" Content="Acceptable Fitness Value:" HorizontalAlignment="Right" />
			<Label Grid.Row="3" Grid.Column="1" Content="{Binding Path=AcceptableFitnessValue}" />
		</Grid>
	</Grid>
</Window>
